<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@include file="common.jsp"%>
<div id="content_right">

	<script type="text/javascript">
		function getDeptEmp(id){
			location.href="../dept/deptEmpAction?deptId="+id;
		}
		
		function getDeptMess(id){
			location.href="../dept/deptMessAction?deptId="+id;
		}
		
		function deleteDept(){
			var c = document.getElementsByName("deptId");
			var n=0;
			for(var i=0;i<c.length;i++){
				if(c[i].checked==true){
					n++;
				}
			}
			if(n==0){
				alert("请选中后再进行删除操作！");
			}else{
				if(confirm('确定删除?')){
		  			document.form1.submit();
					return true;
				}else {
		 			return false;
				}
			}
		}
	</script>
	<p id="whereami">
	</p>
	<
	<h1>
		<font color="red">${message }</font>
	</h1>
	<form action="deptDeleteAction" method="post" name="form1">
		<TABLE class=table cellSpacing=1>
			<TBODY>
				<TR class=table_header>
					<TD vAlign=center align=left></TD>
					<TD vAlign=center align=left>
						ID
					</TD>
					<TD vAlign=center align=left>
						部门名称
					</TD>
					<TD vAlign=center align=left>
						管理人
					</TD>
					<TD vAlign=center align=left></TD>
					<TD vAlign=center align=left></TD>
				</TR>
				<s:iterator value="dlist" var="Department">
					<TR class=row2 onmouseover="this.className='row1'"
						onmouseout="this.className='row2'">
						<TD vAlign=center align=left>
							<input type="checkbox" name="deptId"
								value="<s:property value="#Department.deptId" />">
						</TD>
						<TD vAlign=center align=left>
							<s:property value="#Department.deptId" />
						</TD>
						<TD vAlign=center align=left>
							<s:property value="#Department.deptName" />
						</TD>
						<TD vAlign=center align=left>
							<s:property value="#Department.employee.empName" />
						</TD>
						<TD vAlign=center align=left>
							<INPUT class=button
								onClick='getDeptEmp("<s:property value="#Department.deptId" />");'
								type=button value=部门人员»>
						</TD>
						<TD vAlign=center align=left>
							<INPUT class=button
								onClick='getDeptMess("<s:property value="#Department.deptId" />");'
								type=button value=更改»>
						</TD>
					</TR>
				</s:iterator>
				<tr>
					<td colspan="5" align="right">
						&nbsp;&nbsp;
						<input type="button" class="button" value="删除&gt&gt"
							onclick="deleteDept()" />
					</td>
				</tr>
			</TBODY>


		</TABLE>

	</form>
	<p class="paging">
		<s:if test="%{page == 1}">
							&lt;&lt; 首页 &lt; 上一页
						</s:if>
		<s:else>
			<a href="deptListAction?page=1"> &lt;&lt;首页</a>
			<a href="deptListAction?page=${page-1}">&lt; 上一页 </a>
		</s:else>

		<strong>第${page}页/共${totalPages}页</strong>

		<s:if test="%{page == totalPages}">
							下一页 &gt;
							末页 &gt;&gt;
						</s:if>
		<s:else>
			<a href="deptListAction?page=${page+1}"> 下一页 &gt;</a>
			<a href="deptListAction?page=${totalPages}">末页 &gt;&gt;</a>
		</s:else>
	</p>
	<p>
		&nbsp;
	</p>
	<p>
	</p>

</div>